<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>员工主页面</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui2/css/layui.css"/>
    <style>
        a:hover{
            color: #00b7ee;
        }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header" style="background-image: linear-gradient(120deg, #131313,#4c4c4c);">
        <div class="layui-logo"><a href="yuangong-main.html" style="color: #47b3ff;font-size: 25px;">员工主页</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a class="layui-icon" href="../guanliyuan/guanliyuan-login.html">管理员登录</a></li>
            <li class="layui-nav-item"><a class="layui-icon layui-icon-logout" style="color: #ff3c00;font-size: 20px;text-align: center;" href="yuangong-login.html">退出</a></li>
        </ul>
    </div>

    <div class="layui-side" style=" background-image: linear-gradient(120deg, #a7d3f2,#1E9FFF);">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree layui-bg-black"  lay-filter="test">
                <li class="layui-nav-item">
                    <a href="javascript:;"><i class="layui-icon layui-icon-user" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i> 信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="yuangong-xinxiChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>基本信息修改</a></dd>
                        <dd><a href="yuangong-mimaChange.html"><i class="layui-icon layui-icon-edit" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>修改密码</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed layui-bg-blue">
                    <a class="" href="yuangong-apply.html"><i class="layui-icon layui-icon-form" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>宿舍申请</a>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="letter-box.html"><i class="layui-icon layui-icon-notice" style="font-size: 24px; color: #1E9FFF; margin-right: 16px"></i>通知</a>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body">
        <div class="layui-anim layui-anim-scale" style="margin-top: 50px;margin-left: 50px;">
            <form class="layui-form layui-form-pane" name="form1" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 130px;">项目（小区）</label>
                    <div class="layui-input-inline">
                        <select name="xiangmu" id="xiangmu" lay-filter="xfilter">
                            <option>--请选择--</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 130px;">楼栋</label>
                    <div class="layui-input-inline">
                        <select name="loudong" id="loudong" lay-filter="lfilter">
                            <option>--请选择--</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 130px;">套房</label>
                    <div class="layui-input-inline">
                        <select name="taofang" id="taofang" lay-filter="tfilter" >
                            <option>--请选择--</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 130px;">房间</label>
                    <div class="layui-input-inline">
                        <select name="fangjian" id="fangjian" lay-filter="ffilter" >
                            <option>--请选择--</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 130px;">铺位</label>
                    <div class="layui-input-inline">
                        <select name="puwei" id="puwei" lay-filter="pfilter" >
                            <option>--请选择--</option>
                        </select>
                    </div>
                    <label class="layui-form-label" style="width: 130px;">收费标准</label>
                    <div class="layui-input-inline">
                        <select name="shoufeibiaozhun" id="shoufeibiaozhun" lay-verify="required">
                            <option>--请选择--</option>
                        </select>
                    </div>
                    <div class="layui-input-inline">
                        <button class="layui-btn" id="btn" type="button">查看收费标准</button>
                    </div>
                    <label class="layui-form-label" style="width: 130px;">租房时间</label>
                    <div class="layui-input-inline">
                        <select name="zufangshijian" id="zufangshijian"  lay-verify="required">
                            <option>--请选择--</option>
                            <option value="1">1（年/月）</option>
                            <option value="2">2（年/月）</option>
                            <option value="3">3（年/月）</option>
                            <option value="4">4（年/月）</option>
                            <option value="5">5（年/月）</option>
                            <option value="6">6（年/月）</option>
                            <option value="7">7（年/月）</option>
                            <option value="8">8（年/月）</option>
                            <option value="9">9（年/月）</option>
                            <option value="10">10（年/月）</option>
                            <option value="11">11（年/月）</option>
                            <option value="12">12（年/月）</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 150px;">是否已结婚</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="hunyingzhuangtai"  value="1" title="是">
                        <input type="radio" name="hunyingzhuangtai"  value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 150px;">是否换新宿舍</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="xinsushe"  value="1" title="是">
                        <input type="radio" name="xinsushe"  value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 150px;">是否家庭在深圳</label>
                    <div class="layui-input-block">
                        <input type="radio" name="shenzhen"  value="1" title="是">
                        <input type="radio" name="shenzhen"  value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                <label class="layui-form-label" style="width: 150px;">是否有深圳户口</label>
                <div class="layui-input-block">
                    <input type="radio" name="shenzhenhukou"  value="1" title="是">
                    <input type="radio" name="shenzhenhukou"  value="0" title="否">
                </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label" style="width: 150px;">是否有暂住证</label>
                    <div class="layui-input-block">
                        <input type="radio" name="zanzhuzheng"  value="1" title="是">
                        <input type="radio" name="zanzhuzheng"  value="0" title="否">
                    </div>
                </div>
                <div class="layui-form-item">
                <label class="layui-form-label" style="width: 150px;">是否有介绍信</label>
                <div class="layui-input-block">
                    <input type="radio" name="jieshaoxin"  value="1" title="是">
                    <input type="radio" name="jieshaoxin"  value="0" title="否">
                </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">备注</label>
                    <div class="layui-input-inline">
                        <input type="text" name="beizhu" id="beizhu" autocomplete="off" class="layui-input" lay-verify="required" placeholder="请输入内容">
                    </div>
                    <label class="layui-form-label">原住房情况</label>
                    <div class="layui-input-inline">
                        <input type="text" name="yuanzhufangqingkuang" id="yuanzhufangqingkuang" autocomplete="off" class="layui-input" lay-verify="required" placeholder="请输入内容">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">申请原因</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="yuanyin" lay-verify="required"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">提交</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="layui-footer layui-bg-black">
    </div>
</div>
<script src="../../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function() {
        var form = layui.form
        layer = layui.layer
        $ = layui.jquery;
        var element = layui.element;
        form.render('select');
        element.init();
        $.ajax({
            type: "GET",
            url: "/yuangong/selectAllxiangmu",
            dataType: "json",
            success: function (res) {
                var ops = '<option value="">--请选择--</option>';
                for (var xiangmu of res.data) {
                    ops += '<option value="' + xiangmu.xiangmubianma + '">' + xiangmu.xiangmumingcheng+ '</option>';
                }
                $('#xiangmu').html(ops);
                form.render();
            }
        });
        form.on('select(xfilter)',function() {
            var xiangmubianma = $('#xiangmu').val();
            $.ajax({
                type: "GET",
                url: "/yuangong/selectAllloudong",
                data: {"xiangmubianma": xiangmubianma},
                dataType: "json",
                success: function (res) {
                    var ops = '<option value="">--请选择--</option>';
                    for (var loudong of res.data) {
                        ops += '<option value="' + loudong.loudongbianma + '">' + loudong.loudong + '</option>';
                    }
                    $('#loudong').html(ops);
                    form.render();
                }
            })
        })
        form.on('select(lfilter)',function () {
            var loudongbianma = $('#loudong').val();
            $.ajax({
                type: "GET",
                url: "/yuangong/selectAlltaofang",
                data: {"loudongbianma": loudongbianma},
                dataType: "json",
                success: function (res) {
                    var ops = '<option value="">--请选择--</option>';
                    for (var taofang of res.data) {
                        ops += '<option value="' + taofang.taofangbianma + '">' + taofang.taofangmingcheng+" / 第"+taofang.louceng+"层" + '</option>';
                    }
                    $('#taofang').html(ops);
                    form.render();
                }
            })
        })
        form.on('select(tfilter)',function () {
            var taofangbianma = $('#taofang').val();
            $.ajax({
                type: "GET",
                url: "/yuangong/selectAllfangjian",
                data: {"taofangbianma": taofangbianma},
                dataType: "json",
                success: function (res) {
                    var ops = '<option value="">--请选择--</option>';
                    for (var fangjian of res.data) {
                        ops += '<option value="' + fangjian.fangjianbianma + '">' + fangjian.fangjian + '</option>';
                    }
                    $('#fangjian').html(ops);
                    form.render();
                }
            })
        })
        form.on('select(ffilter)',function () {
            var fangjianbianma = $('#fangjian').val();
            $.ajax({
                type: "GET",
                url: "/yuangong/selectAllpuwei",
                data: {"fangjianbianma": fangjianbianma},
                dataType: "json",
                success: function (res) {
                    var ops = '<option value="">--请选择--</option>';
                    for (var puwei of res.data) {
                        ops += '<option value="' + puwei.puweibianhao + '">' + puwei.puwei + '</option>';
                    }
                    $('#puwei').html(ops);
                    form.render();
                }
            })
        })
        $.ajax({
            type: "GET",
            url: "/shoufeibiaozhun/selectAllshoufeibiaozhun",
            dataType: "json",
            success: function (res) {
                var ops = '<option value="">--请选择--</option>';
                for (var shoufeibiaozhun of res.data) {
                    ops += '<option value="' + shoufeibiaozhun.shoufeibiaozhunma + '">' + shoufeibiaozhun.shoufeibiaozhunmingcheng+ '</option>';
                }
                $('#shoufeibiaozhun').html(ops);
                form.render();
            }
        });
        $(document).on('click','#btn',function(){
            layer.open({
                type: 2
                ,
                skin: 'layui-layer-molv'
                ,
                area: ['800px', '600px']
                ,
                id: 'LAY-1' //设定一个id，防止重复弹出
                ,
                moveType: 1 //拖拽模式，0或者1
                ,
                fixed: false,
                content: "yuangong-shoufeibiaozhun.html",
                shadeClose: true,
            })

        });
        form.on('submit(demo1)',function(data){
            $.ajax({
                type:"POST",
                url:"/shengqindan/add",
                data:{
                    "xiangmubianma":data.field.xiangmu,
                    "loudongbianma": data.field.loudong,
                    "taofangbianma": data.field.taofang,
                    "fangjianbianma": data.field.fangjian,
                    "puweibianhao": data.field.puwei,
                    "shoufeibiaozhun":data.field.shoufeibiaozhun,
                    "zufangshijian":data.field.zufangshijian,
                    "yuanzhufangqingkuang":data.field.yuanzhufangqingkuang,
                    "hunyingzhuangtai":data.field.hunyingzhuangtai,
                    "xinsushe":data.field.xinsushe,
                    "shenzhen":data.field.shenzhen,
                    "shenzhenhukou":data.field.shenzhenhukou,
                    "zanzhuzheng":data.field.zanzhuzheng,
                    "jieshaoxin":data.field.jieshaoxin,
                    "beizhu":data.field.beizhu,
                    "yuanyin":data.field.yuanyin,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag) {
                        layer.msg('提交成功！',{icon:6,offset:"auto",time:2000});//提示框,提示2秒自动消失
                        setTimeout('window.location.reload()',2000);
                    }else  {
                        layer.msg('提交失败！',{icon:5,offset:"auto",time:2000});//提示框
                    }
                }
            })
            return false;
        });

    });
</script>
</body>
</html>